import { get } from "lodash";
import { loginRSA } from "/@/config";
import { md5Encode } from "/@/utils/encrypt";
import request from "/@/utils/request";

const AccountApi = {
  login: async (data: any) => {
    data.password = md5Encode(data.password);
    return request({
      url: "/companyAccount/login",
      method: "post",
      data,
    });
  },
  getMenu: () => {
    return request({
      url: "/companyAccount/initMenu",
      method: "get",
    });
  },
  getUserInfo: () => {
    return request({
      url: "/userInfo",
      method: "get",
    });
  },
    getCompanyList(data: any) {
    return request({
        url: "/user/getCompanyList",
        method: "post",
        data,
    });
},

  logout: () => {
    return request({
      url: "/companyAccount/logout",
      method: "get",
    });
  },

  register: (data: any) => {
    return request({
      url: "/account/register",
      method: "post",
      data,
    });
  },

  password: (data: any) => {
    return request({
      url: "/account/password",
      method: "post",
      data,
    });
  },

  lock: () => {
    return request({
      url: "/account/lock",
      method: "post",
    });
  },
  refreshToken: () => {
    return request({
      url: "/account/refreshToken",
      method: "post",
    });
  },



  // 删除菜单
  consolePermissionDel: (data: any) => {
    return request({
      url: "/consolePermission/del",
      method: "post",
      data,
    });
  },

  //  查菜单详情
  consolePermissionDetail: (data: any) => {
    return request({
      url: "/consolePermission/detail",
      method: "post",
      data,
    });
  },

  //  保存/修改
  consolePermissionSave: (data: any) => {
    return request({
      url: "/consolePermission/save",
      method: "post",
      data,
    });
  },
  h5UserLogin: (data: any)=>{
    return request({
          url: "/user/login",
          method: "post",
          data 
        })

  },
  // h5 获取活动详情
  getDetail(data: any){
      return request({
          url: "/user/drillInfo/getDetail",
          method: "post",
          data,
      })
  },
  // h5报名接口
  signUp(data: any){
      return request({
          url: "/user/drillInfo/signUp",
          method: "post",
          data,
      })
  },
  // 签到报名接口
  signIn(data: any){
      return request({
          url: "/user/drillInfo/signIn",
          method: "post",
          data,
      })
  },
  // 开始学习接口 
  studyBegin(data: any){
      return request({
          url: "/user/drillInfo/startLearning",
          method: "post",
          data,
      })
  },
  // 企业类型获取接口 
  getCompanyTypeList(){
      return request({
          url: "/user/companyInfoType/pageData",
          method: "post",
      })
  },
  // 获取省接口
  getProvinceList(data: any){
      return request({
          url: "/user/area/getprovinces",
          method: "post",
          data,
      })
  },
  // 获取市接口
  getCityList(data: any){
      return request({
          url: "/user/area/getcities",
          method: "post",
          data,
      })
  },
  // 获取区接口
  getNormalAreaList(data: any){
      return request({
          url: "/user/area/getareas",
          method: "post",
          data,
      })
  },
  // 省市区接口
    getAreaList(data: any){
      return request({
          url: "/user/area/getSysAreaList",
          method: "post",
          data,
      })
  },
  // 乡镇接口
  getTownList(data: any){
      return request({
          url: "/user/sysAreasTown/pageData",
          method: "post",
          data,
      })
  },
  // 结束学习接口 
  studyEnd(data: any){
      return request({
          url: "/user/drillInfo/endLearning",
          method: "post",
          data,
      })
  },
  // 考试详情
  examDetail(params:any){
    return request({
      url: "/user/drillExamInfo/getDetail",
      method: "get",
      params,
    })
  },
  // 开始考试
  startExam(params:any){
    return request({
      url: "/user/drillExamInfo/startExam",
      method: "get",
      params,
    })
  },
  submitExam(data:any){
    return request({
      url: "/user/drillExamInfo/submit",
      method: "post",
      headersType: 'application/json;charset=UTF-8',
      data
    })
  },
  // 考试记录
  getExamRecord(){
    return request({
      url: "/user/drillExamRecord/pageData",
      method: "get",
    })
  },
  // 考试记录详情
  getExamDetail(params:any){
    return request({
      url: "/user/drillExamRecord/getDetail",
      method: "get",
      params
    })
  },
  getReportedActivities(){
    return request({
      url: "/user/drillInfo/reportedActivities",
      method: "get",
    })
  },
  getDrillInfoDetail(params:any){
    return request({
      url: "/user/drillInfo/getDetail",
      method: "get",
      params
    })
  }
};
export default AccountApi;
